<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box_container {
            width: 100%;
            height: 100vh;
            background-color: #f4f4f4;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .dv_box {
            width: 500px;
            height: 500px;
            /* background-color: skyblue; */
        }

        p {
            margin-left: 150px;
        }

        #dv {
            width: 100px;
            height: 100px;
            background-color: black;
            margin: 50px auto 0px;
        }
    </style>
</head>

<body>
    <div class="box_container">
        <div class="dv_box">
            <p>
                <button onclick="onClickWidth()">变宽</button>
                <button onclick="onClickHeight()">变高</button>
                <button onclick="onClickBackground()">变色</button>
                <button onclick="onClickDisplay()">隐藏</button>
                <button onclick="onClickReset()">重置</button>
            </p>
            <div id="dv">

            </div>
        </div>
    </div>
</body>
<script>
    var dv = document.getElementById("dv")
    function onClickWidth() {
        dv.style.width = "200px";
    }
    function onClickHeight() {
        dv.style.height = "200px";
    }
    function onClickBackground() {
        dv.style.backgroundColor = "red";
    }
    function onClickDisplay() {
        dv.style.display = "none";
    }
    function onClickReset() {
        dv.style = "";
    }
</script>

</html>